// import crawlTwo from "./systems/panyu_jiwei/crawlTwo/index.js";
// import document from "./systems/panyu_jiwei/document/index.js";
// import cloudMedicine from "./systems/cloud/chineseMedicine/index.js";
import { commonUtil } from "./utils/index.js";
import { SYSTEM } from "./systems/commonConifg.js";

// global.system = "cloud";
// global.community = "NANGANG";
// global.task = "chineseMedicine";

// global.cookie = "JSESSIONID=B68BE39DB390EC6DCF5DCF2034F24C8E";
// global.hisConfigSession = {
//   Sessionid: "D0D7C5E89008E11C464E5E8FD411230A",
//   UserId: "07823834AF2E426993A76DED73095F32",
//   UserName: "潘广辉",
//   UserCode: "015866",
//   EmplType: "1",
//   OrgId: "8abc4ab36699a6ce0166a064e6fb0031",
//   OrgCode: "440112505351",
//   OrgType: "3",
//   HosGrade: "2",
//   Chisunitcode: "440112008000",
//   OrgName: "广州市黄埔区南岗街社区卫生服务中心",
//   RecAuthority: "2",
//   StationID: "8abc4ab36699a6ce0166a064e6fb0031",
//   StationCode: "440112505351",
//   StationName: "广州市黄埔区南岗街社区卫生服务中心",
//   District: "",
//   CurrentTimeLong: 1638364041637,
//   DeptId: "8a44a0967c267fc4017c6e2184400013",
//   DeptCode: "0007",
//   DeptName: "全科门诊",
//   DeptType: "C",
//   UserIDCardNo: "440111198209081255",
//   UserMobileNum: "",
//   UnitGroup: "",
//   UserDeptId: "8a44a0967c267fc4017c6e2184400013",
//   UserDeptCode: "0007",
//   UserDeptName: "全科门诊",
//   CALoginDetail: "",
//   UserProvinceName: "广东省",
//   UserProvinceCode: "440000",
//   UserCityName: "广州市",
//   UserCityCode: "440100",
//   UserDistrictName: "黄埔区",
//   UserDistrictCode: "440112",
//   UserCenterCode: "440112008000",
//   isAdmin: false,
//   isSuperAdmin: false,
//   UserDocposition: "2",
//   canDoPhCHSS: "2",
//   UnitName: "第一团队",
//   FTPUserName: "",
//   FTPUserPassword: "",
//   FTPDBBasePath: "",
//   UnitId20: "8abc4ab36699a6ce0166a064e6fb0031",
//   UnitCode20: "440112008001",
//   UnitName20: "广州市黄埔区南岗街社区卫生服务中心",
//   UserUnitType20: "3",
//   UserId20: "07823834AF2E426993A76DED73095F32",
//   UserCode20: "440112008001",
//   UserName20: "潘广辉",
//   UserCenterCode20: "440112008000",
//   UserCenterName20: "广州市黄埔区南岗街社区卫生服务中心",
//   UserStationCode20: "440112008001",
//   UserStationName20: "第一团队",
//   TeamCode20: "440112008001",
//   TeamName20: "第一团队",
//   ManageMode20: "1",
//   Identitycardno: "440111198209081255",
//   MobileNum: "",
//   CertifiedDocno: "110440104001861",
// };
// global.unieap = {
//   phisCode: "1CA90827599FC849AF7DC9D3C95E57DD",
//   WEB_APP_NAME: "/phis",
//   appPath: "/phis/",
//   appPath20: "",
//   cmpPath: "/phis/ph/pages/welcome/welcome.jsp",
//   dialogRelogin: "true",
//   isEncrypt: false,
//   loginAccount: "ngpgh",
//   orgId: "8abc4ab36699a6ce0166a064e6fb0031",
//   orgCode: "440112505351",
//   orgName: "广州市黄埔区南岗街社区卫生服务中心",
//   stationId: "8abc4ab36699a6ce0166a064e6fb0031",
//   stationCode: "440112505351",
//   stationName: "广州市黄埔区南岗街社区卫生服务中心",
//   deptId: "8a44a0967c267fc4017c6e2184400013",
//   deptCode: "0007",
//   deptName: "全科门诊",
//   locale: "zh_CN",
//   refererURL: "null",
//   currentOrgLicense: "",
//   excptionSep: "%##%",
//   codeMessageSep: ": ",
//   themes: "/phis/public/ria/themes/blue",
//   systemInfo: {
//     IPADDRESS: "10.196.32.23",
//     HOSTNAME: "WIN-P7CQVSNUOVO",
//     USERNAME: "administrator",
//     COMPUTERNAME: "WIN-P7CQVSNUOVO",
//     USERDOMAIN: "WIN-P7CQVSNUOVO",
//     JvmMemoryTotal: "17147887616",
//     JvmMemoryFree: "12384619560",
//     JvmCpuCount: "8",
//     OsName: "Windows Server 2012 R2",
//     OsArch: "amd64",
//     OsVersion: "6.3",
//     OsLanguage: "zh",
//     OsCountry: "CN",
//     webAppRealPath: "D:\\apache-tomcat-7.0.100\\webapps\\phis\\",
//     webServerInfo: "Apache Tomcat/7.0.109",
//     webServerPort: "7001",
//     webInputArgs:
//       "[-Djava.util.logging.config.file=D:\\apache-tomcat-7.0.100\\conf\\logging.properties, -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager, -Xms16384M, -Xmx16384M, -XX:PermSize=1024M, -XX:MaxNewSize=5120M, -XX:MaxPermSize=1024M, -Dfile.encoding=UTF-8, -Djdk.tls.ephemeralDHKeySize=2048, -Dignore.endorsed.dirs=, -Dcatalina.base=D:\\apache-tomcat-7.0.100, -Dcatalina.home=D:\\apache-tomcat-7.0.100, -Djava.io.tmpdir=D:\\apache-tomcat-7.0.100\\temp]",
//   },
// };

async function main() {
  const system = await commonUtil.selectSystem(SYSTEM);
  const taskName = await commonUtil.selectTask(system);
  const { USERS } = await import(`./systems/${system}/config.js`);
  await commonUtil.selectCommunity(USERS);
  const task = await import(`./systems/${system}/${taskName}/index.js`);
  await task.default();
}

main().catch((err) => {
  console.error(err);
});
